#include "modeloteorico.h"
#include <math.h>
#include <QDebug>

ModeloTeorico::ModeloTeorico()
{
}


double ModeloTeorico::calculateSphericalModel(double distance, double reach,
                                              double nuggetEffect, double contribution){

    
    double y =0;


    if(distance == 0){
        y = 0;
    }


    if((0<distance) && (distance<=reach)){

        qDebug()<< "contribution "<< contribution;
        qDebug()<< "reach "<< reach;
        qDebug()<< "contribution "<< contribution;
        qDebug()<< "Divisao " << (distance/reach);
        qDebug()<< "Potencia "<< pow((distance/reach),3);
        qDebug()<< "Multiplic "<< (1.5 * (distance/reach) - 0.5 * pow((distance/reach),3));


        y = nuggetEffect + (contribution * (1.5 * (distance/reach) - 0.5 * pow((distance/reach),3)));

        qDebug()<< " y: "<< y;

    }

    if(distance > reach){

        y = nuggetEffect + contribution;
    }


    return y;
}
